<%-- 
    Document   : admin
    Created on : Feb 21, 2011, 8:50:32 PM
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@include file="../header.jsp"%>
<html>
<head>
<script type="text/javascript" src="js/upload.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>管理员控制台</title>
</head>
<body>

	<%
		if (request.getSession().getAttribute("username") == null) {
	%>
	<form action="admin.action" method="post">
		<input type="text" name="name" value="" /> <input type="submit"
			value="输入您的名字" />
	</form>
	<%
		} else {
	%>
	HI, welcome admin [<%=request.getSession().getAttribute("username")%>]
	<a href="admin.action?logout=1"> [退出] </a>
	<hr />
	<form id="uploadForm" action="admin_upload.action" method="post"
		enctype="multipart/form-data" target="target_upload">
		<table align="left" border="1px solid #ccc"
			style="width: 50%; height: 300px;">
			<tr>
				<td>上传图片(只支持png,gif,jpg,bmp)</td>
				<td><input name="picpath" id="picpath" type="file" value="浏览"
					onchange="changefile(this)" />
				</td>
			</tr>
			<tr>
				<td>图片名:</td>
				<td><input id="picname" name="picname" type="text" value="" />
				</td>
			</tr>
			<tr>
				<td>年月份:</td>
				<td><select id="year" name="year">
						<%
							String curDate = DateHelper.getCurrentDate()
										.replaceAll("-", "");
								int curYear = Integer.parseInt(curDate.substring(0, 4));
								for (int i = -20; i < 20; i++) {
						%>
						<option value="<%=(curYear + i)%>"<%if (i == 0) out.print(" selected");%>><%=(curYear + i)%></option>
						<%
							}
						%>
				</select>年 
				<select id="month" name="month">
						<%
							int curMonth = Integer.parseInt(curDate.substring(4, 6));
						
								for (int i = 1; i <= 12; i++) {
									String k=i<10?"0"+i:i+"";
						%>
						<option value="<%=k%>" <%if (i == curMonth) out.print("  selected");%>><%=k%></option>
						<%
							}
						%>
				</select>月</td>
			</tr>
			<tr>
				<td>图片描述:</td>
				<td><textarea cols="30" rows="5" name="picdesc" id="picdesc"></textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2">上传进度条</td>
			</tr>
			<tr>
				<td colspan="2"><div class="processBar" id="processBar"></div>
				</td>
			</tr>
			<tr>
				<td colspan="2"><div id="processDesc"></div></td>
			</tr>
			<tr>
				<td align="center" colspan="2">主题: <select id="flag"
					name="flag">
						<option value="01">锋锋的故事</option>
						<option value="02">默默的故事</option>
						<option value="03">美好回憶</option>
				</select> <input id="uploadBtn" type="button" value="上传"
					onclick="uploadfile()" /> &nbsp; &nbsp; <input type="button"
					value="刷新列表" onclick=" f$('piclist').src='page/admin/piclist.jsp'" />
					&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="button" value="全选"
					onclick=" choiceAll()" /> <input type="button" value="批量删除"
					onclick=" batchdel()" />
				</td>
			</tr>
		</table>
	</form>
	<table id="processTab" border="1" style="width: 49%; height: 300px;">
		<th height="10px">上传文件日志</th>
		<tr>
			<td valign="top">
				<div id="log"
					style="word-wrap: break-word; word-break: break-all; overflow-y: auto; height: 288px; width: 600px">
				</div>
			</td>
		</tr>

	</table>
	<iframe id='target_upload' name='target_upload' src=''
		style='display: none'></iframe>
	<hr />
	<iframe id='piclist' name="piclist" height="210px" width="100%"
		name='piclist' src='page/admin/piclist.jsp' frameborder="0"></iframe>
	<%
		}
	%>
</body>
</html>
